package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.PyBalanceService;
import situ.autoweter.entity.PyBalance;
import java.util.*;
/**
 * PyBalance的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class PyBalanceController {

	/** PyBalanceService服务 */
	@Autowired
	private PyBalanceService pyBalanceService;
	
	/**
	 * 查询所有PyBalance数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryPyBalance", produces = {"application/json;charset=UTF-8"})
	public String find(PyBalance value,Map map) {
		 List<PyBalance> list= pyBalanceService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询PyBalance数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryPyBalanceById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        PyBalance obj=  pyBalanceService.findOne(id);
        map.put("PyBalance",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入PyBalance属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "savePyBalance", produces = {"application/json;charset=UTF-8"})
	public String save(PyBalance value) {
		  pyBalanceService.saveNotNull(value);
        return "redirect:/queryPyBalance";
	}
	
	/**
	 * 更新PyBalance属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updatePyBalance", produces = {"application/json;charset=UTF-8"})
	public String update(PyBalance value) {
		  pyBalanceService.updateNotNullById(value);
          return "redirect:/queryPyBalance";
	}
	
	/**
	 * 通过id删除PyBalance数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delPyBalanceById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  pyBalanceService.deleteById(id);
          return "redirect:/queryPyBalance";
	}
}
